home *** CD-ROM | disk | FTP | other *** search
/ New Star Software Collection / NSS_Collection.iso / 3-004 ms visual basic pro 30 / 4.imz / 4.IMA / CD.FR_ / CD.bin
Text File  |  1993-04-28  |  9KB  |  299 lines

  1. VERSION 2.00
  2. Begin Form CD 
  3.    BorderStyle     =   1  'Fixed Single
  4.    ClientHeight    =   3120
  5.    ClientLeft      =   675
  6.    ClientTop       =   1800
  7.    ClientWidth     =   8415
  8.    Height          =   3525
  9.    Left            =   615
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3120
  15.    ScaleWidth      =   8415
  16.    Top             =   1455
  17.    Width           =   8535
  18.    Begin PictureBox Picture4 
  19.       BackColor       =   &H00808080&
  20.       Height          =   3255
  21.       Left            =   0
  22.       ScaleHeight     =   3225
  23.       ScaleWidth      =   1545
  24.       TabIndex        =   12
  25.       Top             =   -15
  26.       Width           =   1570
  27.       Begin PictureBox Picture5 
  28.          BackColor       =   &H00575757&
  29.          Height          =   2895
  30.          Left            =   120
  31.          ScaleHeight     =   2865
  32.          ScaleWidth      =   1275
  33.          TabIndex        =   13
  34.          Top             =   110
  35.          Width           =   1300
  36.       End
  37.    End
  38.    Begin PictureBox Picture6 
  39.       BackColor       =   &H00808080&
  40.       Height          =   3255
  41.       Left            =   6845
  42.       ScaleHeight     =   3225
  43.       ScaleWidth      =   1545
  44.       TabIndex        =   14
  45.       Top             =   -15
  46.       Width           =   1575
  47.       Begin PictureBox Picture7 
  48.          BackColor       =   &H00575757&
  49.          Height          =   2895
  50.          Left            =   120
  51.          ScaleHeight     =   2865
  52.          ScaleWidth      =   1275
  53.          TabIndex        =   15
  54.          Top             =   110
  55.          Width           =   1300
  56.       End
  57.    End
  58.    Begin Frame Frame1 
  59.       BackColor       =   &H00808080&
  60.       Caption         =   "MCI CD Player"
  61.       FontBold        =   -1  'True
  62.       FontItalic      =   0   'False
  63.       FontName        =   "MS Serif"
  64.       FontSize        =   12
  65.       FontStrikethru  =   0   'False
  66.       FontUnderline   =   0   'False
  67.       ForeColor       =   &H00000000&
  68.       Height          =   3135
  69.       Left            =   1560
  70.       TabIndex        =   0
  71.       Top             =   0
  72.       Width           =   5295
  73.       Begin PictureBox Picture3 
  74.          Height          =   255
  75.          Left            =   720
  76.          Picture         =   CD.FRX:0000
  77.          ScaleHeight     =   225
  78.          ScaleWidth      =   945
  79.          TabIndex        =   10
  80.          Top             =   2520
  81.          Visible         =   0   'False
  82.          Width           =   975
  83.       End
  84.       Begin Frame Frame4 
  85.          BackColor       =   &H00808080&
  86.          Height          =   975
  87.          Left            =   2160
  88.          TabIndex        =   6
  89.          Top             =   2040
  90.          Width           =   2895
  91.          Begin CommandButton Command1 
  92.             Caption         =   "Load"
  93.             Height          =   255
  94.             Left            =   1920
  95.             TabIndex        =   7
  96.             Top             =   600
  97.             Width           =   855
  98.          End
  99.          Begin PictureBox Picture1 
  100.             BackColor       =   &H00404040&
  101.             BorderStyle     =   0  'None
  102.             Height          =   255
  103.             Left            =   120
  104.             Picture         =   CD.FRX:09D2
  105.             ScaleHeight     =   255
  106.             ScaleWidth      =   2655
  107.             TabIndex        =   8
  108.             Top             =   240
  109.             Width           =   2655
  110.          End
  111.          Begin Label Label3 
  112.             BackColor       =   &H00404040&
  113.             Height          =   135
  114.             Left            =   1485
  115.             TabIndex        =   11
  116.             Top             =   600
  117.             Width           =   255
  118.          End
  119.       End
  120.       Begin PictureBox Picture2 
  121.          Height          =   255
  122.          Left            =   720
  123.          Picture         =   CD.FRX:1068
  124.          ScaleHeight     =   225
  125.          ScaleWidth      =   945
  126.          TabIndex        =   9
  127.          Top             =   2040
  128.          Visible         =   0   'False
  129.          Width           =   975
  130.       End
  131.       Begin Frame Frame2 
  132.          BackColor       =   &H00808080&
  133.          Height          =   1455
  134.          Left            =   240
  135.          TabIndex        =   1
  136.          Top             =   480
  137.          Width           =   4815
  138.          Begin MMControl MMControl1 
  139.             BackVisible     =   0   'False
  140.             Height          =   615
  141.             Left            =   2160
  142.             RecordVisible   =   0   'False
  143.             StepVisible     =   0   'False
  144.             TabIndex        =   2
  145.             Top             =   360
  146.             Width           =   2370
  147.          End
  148.          Begin Frame Frame3 
  149.             BackColor       =   &H00808080&
  150.             Height          =   855
  151.             Left            =   720
  152.             TabIndex        =   3
  153.             Top             =   240
  154.             Width           =   855
  155.             Begin Label Label4 
  156.                BackColor       =   &H00808080&
  157.                Caption         =   " Track   "
  158.                Height          =   255
  159.                Left            =   120
  160.                TabIndex        =   5
  161.                Top             =   480
  162.                Width           =   615
  163.             End
  164.             Begin Label Label1 
  165.                Alignment       =   2  'Center
  166.                Caption         =   "0"
  167.                Height          =   255
  168.                Left            =   240
  169.                TabIndex        =   4
  170.                Top             =   240
  171.                Width           =   375
  172.             End
  173.          End
  174.       End
  175.    End
  176. End
  177.  
  178. Sub Command1_Click ()
  179.     ' Open the CD device -- the disk must already be
  180.     ' in the drive.
  181.     On Error GoTo MCI_ERROR
  182.     MMControl1.Command = "Open"
  183.     On Error GoTo 0
  184.     
  185.     ' Set the time format
  186.     MMControl1.TimeFormat = MCI_FORMAT_TMSF
  187.     
  188.     ' Disable the Load command button, display the
  189.     ' "disk in drive" bitmap.
  190.     Command1.Enabled = False
  191.     Picture1.Picture = Picture3.Picture
  192.     
  193.     ' Set the track number to the first track.
  194.     Label1.Caption = "1"
  195.     Exit Sub
  196.  
  197. MCI_ERROR:
  198.     DisplayErrorMessageBox
  199.  
  200.     Resume MCI_EXIT
  201.  
  202. MCI_EXIT:
  203.     Unload CD
  204. End Sub
  205.  
  206. Sub Form_Load ()
  207.     ' Force the MCI control to complete before returning
  208.     ' to the application.
  209.     MMControl1.Wait = True
  210.     
  211.     MMControl1.UpdateInterval = 0
  212.     
  213.     ' Set the DeviceType to a musical CD device.
  214.     MMControl1.DeviceType = "CDAudio"
  215.  
  216.     ' Set the track number to 0 (default).
  217.     Label1.Caption = "0"
  218. End Sub
  219.  
  220. Sub Form_Unload (Cancel As Integer)
  221.     MCITest.Show
  222. End Sub
  223.  
  224. Sub MMControl1_EjectClick (Cancel As Integer)
  225.     ' Enable the Load command button, and display the
  226.     ' "disk out of drive" bitmap.
  227.     Command1.Enabled = True
  228.     Picture1.Picture = Picture2.Picture
  229.     MMControl1.UpdateInterval = 0
  230.     
  231.     ' Eject the disk from the CD drive, and close the device.
  232.     On Error GoTo MCI_ERROR2
  233.     MMControl1.Command = "Eject"
  234.     MMControl1.Command = "Close"
  235.     On Error GoTo 0
  236.     
  237.     ' Set the track number back to 0.
  238.     Label1.Caption = "0"
  239.     
  240.     ' Set the "play indicator" to off.
  241.     Label3.BackColor = &H404040
  242.     Exit Sub
  243.  
  244. MCI_ERROR2:
  245.     DisplayErrorMessageBox
  246.     Resume Next
  247. End Sub
  248.  
  249. Sub MMControl1_NextCompleted (ErrorCode As Long)
  250.     ' Set the track number to the new track.
  251.     Label1.Caption = Str$(MMControl1.Track)
  252. End Sub
  253.  
  254. Sub MMControl1_PauseClick (Cancel As Integer)
  255.     MMControl1.UpdateInterval = 0
  256.         
  257.     'Set the "play indicator" to off.
  258.     Label3.BackColor = &H404040
  259. End Sub
  260.  
  261. Sub MMControl1_PlayClick (Cancel As Integer)
  262.     MMControl1.UpdateInterval = 1000
  263.     
  264.     ' Set the track number to the current track.
  265.     Label1.Caption = Str$(MMControl1.Track)
  266. End Sub
  267.  
  268. Sub MMControl1_PrevCompleted (ErrorCode As Long)
  269.     ' Set the track number to new track.
  270.     Label1.Caption = Str$(MMControl1.Track)
  271. End Sub
  272.  
  273. Sub MMControl1_StatusUpdate ()
  274.     ' Set the track number to the current track.
  275.     Label1.Caption = Str$(MMControl1.Position And &HFF)
  276.  
  277.     ' Determine if the "play indicator" is off or on,
  278.     ' based if the device is currently playing.
  279.     If MMControl1.Mode = MCI_MODE_PLAY Then
  280.         Label3.BackColor = &H80FF&
  281.     Else
  282.         Label3.BackColor = &H404040
  283.     End If
  284. End Sub
  285.  
  286. Sub MMControl1_StopClick (Cancel As Integer)
  287.     MMControl1.UpdateInterval = 0
  288.     
  289.     ' Set the "play indicator" to off.
  290.     Label3.BackColor = &H404040
  291.  
  292.     ' Reset the CD to track 1.
  293.     MMControl1.To = MMControl1.Start
  294.     MMControl1.Command = "Seek"
  295.     MMControl1.Track = 1
  296.     Label1.Caption = "1"
  297. End Sub
  298.  
  299.